<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <body>
        <ui:composition template="../plantilla/plantilla.xhtml">
            <ui:define name="content">
                <h:panelGrid columns="1" style="vertical-align: top">
                    <h:panelGrid columns="3">
                        <h:outputLabel for="ubi" value="Ubicación: " style="float: left"/>
                        <p:selectOneMenu id="ubi" value="#{galleryBean.depto}">
                            <f:selectItem itemLabel="SAN SALVADOR" itemValue="SAN SALVADOR" />
                            <f:selectItem itemLabel="AHUACHAPAN" itemValue="AHUACHAPAN" />
                            <f:selectItem itemLabel="SANTA ANA" itemValue="SANTA ANA" />
                            <f:selectItem itemLabel="SONSONATE" itemValue="SONSONATE" />
                            <f:selectItem itemLabel="CHALATENANGO" itemValue="CHALATENANGO" />
                            <f:selectItem itemLabel="CABAÑAS" itemValue="CABAÑAS" />                                
                            <f:selectItem itemLabel="LA PAZ" itemValue="LA PAZ" />
                            <f:selectItem itemLabel="SAN VICENTE" itemValue="SAN VICENTE" />
                            <f:selectItem itemLabel="USULUTAN" itemValue="USULUTAN" />
                            <f:selectItem itemLabel="SAN MIGUEL" itemValue="SAN MIGUEL" />
                            <f:selectItem itemLabel="MORAZAN" itemValue="MORAZAN" />
                            <f:selectItem itemLabel="LA UNION" itemValue="LA UNION" />
                        </p:selectOneMenu>
                        <p:commandButton value="Ver galería" action="#{galleryBean.updateData}" update=":form:listaInterTable"/>
                    </h:panelGrid>
                    

                    <p:dataTable var="row" emptyMessage="No se encontraron registros"  
                        value="#{galleryBean.images}" paginatorPosition="bottom"
                        rowKey="#{row.idctv}" paginator="true" rows="2"  style="width: 100%; float: left; " 
                        id="listaInterTable">
                        <p:column  >
                            <p:panel style="margin-bottom: 20px;">
                                <h:panelGrid columns="1"  >
                                    <f:facet name="header"  >
                                        <p:graphicImage value="#{galleryBean.streamImagen}" width="525px" height="200px"  >
                                            <f:param name="nameImage" value="#{row.casa1.nombrefoto}"/>                                
                                        </p:graphicImage>
                                    </f:facet>
                                    <h:panelGrid columns="1" >
                                        <p:commandLink id="idBut1" value="#{row.casa1.direccion}" action="#{galleryBean.cargarImagenesDetalle}" update=":form:dialogShow">
<!--                                            <f:setPropertyActionListener target="{galleryBean.codCasa}" value="{row.casa1.idcasater}"/>-->
                                            <f:setPropertyActionListener target="#{galleryBean.casa}" value="#{row.casa1}"/>
                                        </p:commandLink>
                                    </h:panelGrid>
                                </h:panelGrid>
                            </p:panel>
                        </p:column>
                        <p:column >
                            <p:panel style="margin-bottom: 20px">
                                <h:panelGrid columns="1" >
                                    <f:facet name="header"  >
                                        <p:graphicImage value="#{galleryBean.streamImagen}" width="525px" height="200px"  >
                                            <f:param name="nameImage" value="#{row.casa2.nombrefoto}"/>                                
                                        </p:graphicImage>
                                    </f:facet>
                                    <h:panelGrid columns="1">                                        
                                        <p:commandLink id="idBut2" value="#{row.casa2.direccion}" action="#{galleryBean.cargarImagenesDetalle}" update=":form:dialogShow">
<!--                                            <f:setPropertyActionListener target="{galleryBean.codCasa}" value="{row.casa2.idcasater}"/>-->
                                            <f:setPropertyActionListener target="#{galleryBean.casa}" value="#{row.casa2}"/>
                                        </p:commandLink>
                                    </h:panelGrid>
                                </h:panelGrid>
                            </p:panel>
                        </p:column>
                    </p:dataTable>
                    
                </h:panelGrid>
                <p:dialog id="dialogShow" widgetVar="dialogShow" modal="true" appendToBody="true" width="650" height="560" >
                    <h:panelGrid columns="1" style="width: 600px;">
                        <p:galleria value="#{galleryBean.detCasa.fotosDet}" var="imagenDet" panelHeight="250" panelWidth="550" >
                            <p:graphicImage value="#{galleryBean.streamImagenDet}" width="100%" height="100%" >
                                <f:param name="nombImagenDet" value="#{imagenDet}"/>
                            </p:graphicImage>
                        </p:galleria>
                        <h:outputText value="#{galleryBean.casa.direccion}"   />
                        <h:outputText value="$ #{galleryBean.casa.precio}" />
                        <h:outputText value="#{galleryBean.casa.descripcion}"/>
                        <h:outputText value="#{galleryBean.casa.banios} baños" />
                        <h:outputText value="#{galleryBean.casa.cuartos} cuartos"/>
                        <h:outputText value="#{galleryBean.detCasa.descDet}"/>
                        
                        <p:gmap id="mapa" widgetVar="mapa" center="13.706881, -89.21373179999999" zoom="13" type="HYBRID"
                                style="width:600px;height:400px" model="#{galleryBean.simpleMapModel}" />
                        
                    </h:panelGrid>
                    
                </p:dialog>
                
            </ui:define>
        </ui:composition>
    </body>
</html>
